<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

<div class="block">
    
    <div class="block_head">
        <div class="bheadl"></div>
        <div class="bheadr"></div>
        
        <h2>Statistics chart</h2>
        
    </div>
    <!-- .block_head ends -->

    <div class="block_content tab_content clearfix">
        <html:form styleClass="chart_form" action="/admin/dashboard.do" method="get">
            <div class="chart_mode_wrapper clearfix">
                <div class="content">
                    <a class="item submit table_mode gray">Table</a>
                    <a class="item submit chart_mode ">Chart</a>
                    <logic:notEmpty name="yearList">
                        <span class="item">
                            <label>Year:</label>
                            <html:select styleClass="chzn-select chart_year" property="year">
                                <logic:iterate id="year" name="yearList">
                                    <html:option value="${year}">${year}</html:option>
                                </logic:iterate>
                            </html:select>
                        </span>
                    </logic:notEmpty>
                </div>
            </div>
        </html:form>
        <table class="stats" rel="bar" cellpadding="0" cellspacing="0" width="100%">
            
            <thead>
                <tr>
                    <td>&nbsp;</td>
                    <logic:iterate id="month" name="monthList" indexId="index">
                        <logic:notEqual name="index" value="12">
                            <th scope="col">${month}</th>
                        </logic:notEqual>
                    </logic:iterate>
                </tr>
            </thead>
            
            <tbody>
                <tr>
                    <th scope="row">Lands</th>
                    <logic:iterate id="countLand" name="countLandList">
                        <td>${countLand[1]}</td>
                    </logic:iterate>
                </tr>
                
                <tr>
                    <th scope="row">Buildings</th>
                    <logic:iterate id="countBuilding" name="countBuildingList">
                        <td>${countBuilding[1]}</td>
                    </logic:iterate>
                </tr>
                
                <tr>
                    <th scope="row">Sales</th>
                    <logic:iterate id="countSale" name="countSaleList">
                        <td>${countSale[1]}</td>
                    </logic:iterate>
                </tr>
            </tbody>
        </table>
        
    </div>
    <!-- .block_content ends -->
    
    <div class="bendl"></div>
    <div class="bendr"></div>
</div>


<div class="block medium left">
    
    <div class="block_head">
        <div class="bheadl"></div>
        <div class="bheadr"></div>
        
        <h2>Recent Contacts</h2>
        
    </div>
    <!-- .block_head ends -->

    
    <div class="block_content clearfix">
        
        <table cellpadding="0" cellspacing="0" width="100%" class="sortable">
            
            <thead>
                <tr>
                    <th>Name</th>
                    <th>Email</th>
                    <th style="width: 150px;">Sent</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <logic:iterate id="contact" name="contactList">
                        <td>     
                            <html:link action="/admin/contact.do" paramId="contactID" paramName="contact" paramProperty="contactID">
                                <bean:write name="contact" property="name"/>
                            </html:link>
                        </td>
                        <td>     
                            <html:link action="/admin/contact.do" paramId="contactID" paramName="contact" paramProperty="contactID">
                                <bean:write name="contact" property="email"/>
                            </html:link>
                        </td>
                        <td>
                            <fmt:formatDate type="both" value="${contact.createdDate}"/>
                        </td>
                    </logic:iterate>
                </tr>
            </tbody>
            
        </table>
        
    </div>
    <!-- .block_content ends -->
    
    <div class="bendl"></div>
    <div class="bendr"></div>
</div>
<!-- .block ends -->



<div class="block tiny right">
    
    <div class="block_head">
        <div class="bheadl"></div>
        <div class="bheadr"></div>
        
        <h2>Global Statistics</h2>
    </div>
    <!-- .block_head ends -->

    
    <div class="block_content clearfix">
        
        <table cellpadding="0" cellspacing="0" width="100%" class="sortable">
            <thead>
                <th>Statistics</th>
                <th width="20%">Count</th>
            </thead>
            <tbody>
                <logic:iterate id="count" name="countList">
                    <tr>
                        <td>${count[0]}</td>
                        <td>${count[1]}</td>
                    </tr>
                </logic:iterate>
            </tbody>
            
        </table>
        
    </div>
    <!-- .block_content ends -->
    
    <div class="bendl"></div>
    <div class="bendr"></div>
    
</div>
<!-- .block.small.left ends -->